bool PopulateListFromDirectory(wxListView *listView, const wxString &pPath);
void DisplayContextMenu(HWND hwnd, HWND hwndContext, LPCWSTR pszPath, UINT xPos, UINT yPos);
void InvokeDefaultItem(HWND hwnd, HWND hwndContext, LPCWSTR pszPath, UINT xPos, UINT yPos);
wxIcon GetIconFromFile(const wxString &file, bool isDirectory = false);
bool GetDirectoryList(const wxString &pPath, vector<ItemInfo *> &list);

class wxDirTraverserMy : public wxDirTraverser
{
public:
	wxDirTraverserMy(wxArrayString& pFiles, wxArrayString& pDirectories, vector<LARGE_INTEGER> &pFileSizes, LARGE_INTEGER &pTotalFileSize, bool pCalcualteSizes);
	virtual wxDirTraverseResult OnFile(const wxString& filename);	
	virtual wxDirTraverseResult OnDir(const wxString& dirname);	

private:
	wxArrayString& files;
	wxArrayString& directories;
	LARGE_INTEGER &totalFileSize;
	vector<LARGE_INTEGER> &fileSizes;
	bool calcualteSizes;
};

class FileTreeNode;
typedef boost::shared_ptr<FileTreeNode> FileTreeNodePtr;

class FileTreeNode
{
public:
	wxString fullPath;
	wxArrayString files;
	vector<LARGE_INTEGER> fileSizes;
	vector<FileTreeNodePtr> directories;
	LARGE_INTEGER totalSize;
};

class FileTreeBuilder
{
public:
	FileTreeBuilder();
	void BuildTree(const wxString &rootPath, bool calculateSizes);
	void BuildTree(const wxString &rootPath, const wxArrayString &directories, const wxArrayString &files, bool calculateSizes);
	FileTreeNodePtr GetRoot();
	LARGE_INTEGER GetTotalFileSize();
	unsigned int GetNumberOfFiles();
private:
	void BuildTree(FileTreeNodePtr node, const wxString &rootPath, bool calculateSizes);
	FileTreeNodePtr root;
	LARGE_INTEGER totalFileSize;
	unsigned int numberOfFiles;
};